package fhp.hlhj.giantfold.module

import com.lzy.okgo.model.HttpParams
import fhp.hlhj.giantfold.javaBean.CashDetailBean
import fhp.hlhj.giantfold.javaBean.GainDetailBean
import fhp.hlhj.giantfold.network.UrlApis

/**
 * author: FHP
 * data: on 2018\1\29 0029 10:34
 * E-Mail: 103945089@qq.com
 */
class AccontDetailModule {
    interface OnGetAccontDetailListener{
        fun showLoading()
        fun onDetailListener(cashDetailBean: CashDetailBean)
        fun onGainListener(gainDetailBean: GainDetailBean)
    }

    /**
     *
     * 提现明细
     */
    fun getaccontDetail(params: HttpParams,listener: OnGetAccontDetailListener){
        UrlApis.getCashDetail(params)
                .doOnSubscribe {
                    listener.showLoading()
                }
                .subscribe {
                    data->
                    listener.onDetailListener(data)
                }
    }

    /**
     * 收益明细
     */
    fun getGainDetail(params: HttpParams,listener: OnGetAccontDetailListener){
        UrlApis.getGainDetail(params)
                .doOnSubscribe { listener.showLoading() }
                .subscribe {
                    data->
                    listener.onGainListener(data)
                }
    }
    /**
     * 消费总额明细
     */
    fun getSpendDetail(params: HttpParams,listener: OnGetAccontDetailListener){
        UrlApis.getSpendDetail(params)
                .doOnSubscribe { listener.showLoading() }
                .subscribe {
                    data->
                    listener.onGainListener(data)
                }
    }
    /**
     * 消费总额明细
     */
    fun getAva(params: HttpParams,listener: OnGetAccontDetailListener){
        UrlApis.getAvalableDetail(params)
                .doOnSubscribe { listener.showLoading() }
                .subscribe {
                    data->
                    listener.onGainListener(data)
                }
    }
}